home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FNT2BDF.ZIP / fnt2bdf.hh < prev    next >
Text File  |  1994-11-19  |  3KB  |  89 lines

  1. #define TRUE   (1==1)
  2. #define FALSE  (1==0)
  3.  
  4. enum data_types {dfChar, dfShort, dfLong, dfString};
  5.  
  6. struct fnt_hdrS 
  7. {
  8.     unsigned char dfVersion[2];     // Version (always 0x3000 
  9.     unsigned char dfSize[4];            // Total File Size 
  10.     unsigned char dfCopyright[60];      // Copyright notice 
  11.     unsigned char dfType[2];            // Vector or bitmap font 
  12.     unsigned char dfPoints[2];          // Nominal point size 
  13.     unsigned char dfVertRes[2];     // Vertical Resolution 
  14.     unsigned char dfHorizRes[2];        // Horizontal Resolutionchar  
  15.     unsigned char dfAscent[2];          // Character ascent in pixels 
  16.     unsigned char dfInternalLeading[2]; // Leading included in character defn 
  17.     unsigned char dfExternalLeading[2]; // Leading to be added by Windows 
  18.     unsigned char dfItalic[1];             // 1=Italic font 
  19.     unsigned char dfUnderline[1];          // 1=underlined font 
  20.     unsigned char dfStrikeOut[1];          // 1=strike-out font 
  21.     unsigned char dfWeight[2];          // Weight: 400=normal 
  22.     unsigned char dfCharSet[1];            // Character Set for this font 
  23.     unsigned char dfPixWidth[2];        // Character width (0 for proportional) 
  24.     unsigned char dfPixHeight[2];       // Character height 
  25.     unsigned char dfPitchAndFamily[1];     // Font Pitch and family 
  26.     unsigned char dfAvgWidth[2];        // Average character width 
  27.     unsigned char dfMaxWidth[2];        // Maximum character width 
  28.     unsigned char dfFirstChar[1];          // Firwst character of the font 
  29.     unsigned char dfLastChar[1];           // Last character of the font 
  30.     unsigned char dfDefaultChar[1];        // Missing character 
  31.     unsigned char dfBreakChar[1];          // Character to indicate word breaks 
  32.     unsigned char dfWidthBytes[2];      // Number of bytes in each row 
  33.     unsigned char dfDevice[4];          // Offset to device name 
  34.     unsigned char dfFace[4];            // Offset to type face name 
  35.     unsigned char dfBitsPointer[4];
  36.     unsigned char dfBitsOffset[4];      // Offset to bitmaps 
  37.     unsigned char dfReserved[1];
  38.     unsigned char dfFlags[4];           // Bitmapped flags 
  39.     unsigned char dfAspace[2];
  40.     unsigned char dfBspace[2];
  41.     unsigned char dfCspace[2];
  42.     unsigned char dfColorTable[2];      ///Offset to Color table
  43.     unsigned char dfReserved1[4];
  44. };
  45.  
  46. struct WinCharS
  47. {
  48.     unsigned int charWidth;
  49.     unsigned int charOffset;
  50. };
  51.  
  52. struct fnt_fontS
  53. {
  54.     struct fnt_hdrS hdr;
  55.     struct WinCharS     *dfCharTable;
  56.     unsigned char    *dfDeviceP;
  57.     unsigned char     *dfFaceP;
  58.     unsigned char     *dfBitsPointerP;
  59.     unsigned char     *dfBitsOffsetP;
  60.     short         *dfColorTableP;
  61. };
  62.  
  63. #define BUFMAX   15000
  64.  
  65. class CPE_FONT  {
  66.     
  67.     public:
  68.     CPE_FONT(char *);                // Class constructor
  69.        ~CPE_FONT(void);                    // "   " destructor
  70.  
  71.     void dump_font_hdr(void);        // dump the font header portion
  72.     void dump_font_bitmaps(void);        // dump the font bitmap data
  73.     void dump_bdf(void);
  74.  
  75.     private:
  76.     char          *dotdash(char);
  77.     char              cpe_filename[256];
  78.     unsigned char      file_buffer[15000];
  79.         struct fnt_fontS   cpe_font_struct;
  80.         int                return_data_value(enum data_types, unsigned char *);
  81.     int           cpe_max_bytes;
  82.         
  83.        FILE          *fPbdf;
  84.  
  85.     void           dump_bdf_hdr(void),
  86.                make_bdf_filename(char *);
  87.     };
  88.  
  89.